
local mt = ac.skill['跃击']
mt.area = 1200
mt.count = 1
mt.model1 = [[73008b3726097f506598b6b1092a031b.mdx]]

function mt:on_cast_shot()
    local hero = self.owner
    self:on_run(self.count)
end

function mt:on_run(count)
    local hero = self.owner
    local target = ac.selector('unit'):range(hero,self.area):enemy(hero):filter(function(a)
        return a:is_type('英雄')
    end):random()
    if target and hero:is_alive() then
        local damage = hero:get('攻击') * self.data1/100
        local point1 = target:get_point()
        local point2 = hero:get_point()
        local range = point1*point2
        local time = range/1200
        local effect1 = hero:add_effect(self.effect,'hand left')
        local effect2 = hero:add_effect(self.effect,'hand right')
        hero:add_effect([[9753276ca38a709ee315c35f23214d61.mdl]],'chest',1)
        hero:add_restriction '硬直'
        ac.wait(0,function()
            hero:set_facing(point1/point2,1)
            hero:play_animation('attack')
        end)
        ac.hint_red(point1,300,0.5 + time)
        local mover = ac.mover('point'){
            mover = hero,
            start = hero,
            height = 0,
            target = point1,
            max_height = 400,
            arc = 0.1,
            speed = 1200,
            pause_count = 1,
            on_remove = function()
                effect1:remove()
                effect2:remove()
                point1:effect{
                    model = self.model1,
                    size = 2,
                }:remove()
                hero:remove_restriction '硬直'
                hero:aoe_damage(point1,300,damage,'魔法',function(unit)
                    unit:add_buff '晕眩'{time = 1}
                end)
                count = count - 1
                if count>0 then
                    self:on_run(count)
                else
                    hero:issue_order('attack',ac.enemy.base)
                end
            end
        }
        ac.wait(500,function()
            mover:set_pause(false)
        end)
    else
        hero:issue_order('attack',ac.enemy.base)
    end
end

